/*
 * @version: 1.0
 * @Author: zhl
 * @Date: 2021-08-25 15:55:50
 * @LastEditors: zhl
 * @LastEditTime: 2021-09-24 14:39:07
 * @Description: file content
 */
#ifndef __COMMON_H__
#define __COMMON_H__


#include "findfirst.h"


typedef void *(*TFUNCTION_CALLBACK)(void *);


#ifdef __cplusplus
extern "C"{
#endif




extern int exec_cmd(char *cmd, char *result, int len);
extern void millisecond_sleep(int ms);
extern uint64_t get_timestamp();
extern char* get_uart_timestamp(char* timestamp);
//计算指定时间戳(秒级)，0点的时间戳
extern uint64_t timestamp_zero_time(uint64_t ts);
//当前日期0点的时间戳，秒级
extern uint64_t today_timestamp();
extern char* get_uart_timestamp_withms(uint64_t tms);

//当日剩余秒数
extern uint64_t today_level_time_s();
//
uint64_t get_timestamp_by_time_string(char* str_time);
//
extern uint64_t get_timestamp_by_uartstr(char* date_time);

// extern char* string_replace(const char* resource_str, const char* sub_str, char* new_str);
extern char *get_extension(char *filename);
//
extern void bswap_16(uint8_t *data);
// extern void bswap_32(uint16_t *data);
extern void wswap_32(uint16_t *data);
//
extern int get_dev_sn(char *sn, int sn_len);
//
// extern int float_compare(char* f1, char* f2);
//每16个字节为一组对缓冲区进行打印
extern void print_buf(char *buf, int buf_len);
//run self
extern int exec_self(char **argv);
//
extern void get_rand_str(char *s,int num);

extern pid_t get_processpid_byname(const char *proc_name,pid_t cur_pid);

#ifdef __cplusplus
}
#endif






#endif /* __COMMON_H__ */